for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
const defaultOnUnknownActionTypeHandler = (state, action) => {
defaultOnUnknownActionTypeHandler
const error = new Error('Unknown action type ' + action.type)
error.state = state
error.action = action
throw error
}
const createReducerViaMap = (map, initial, onUnknownActionType = defaultOnUnknownActionTypeHandler) =>
(state, action) => {
if (typeof state === 'undefined') {
return initial
} else if (map.hasOwnProperty(action.type)) {
return map[action.type](state, action)
} else if (action.type === '@@redux/INIT') {
} else {
return onUnknownActionType(state, action)
createReducerViaMap.justReturnState = (state, action) => state
action
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.
export default createReducerViaMap